<?php

// +----------------------------------------------------------------------
// | 版权所有 2017-2027 云南环拓科技有限公司，并保留所有权利。
// +----------------------------------------------------------------------
// | Copyright (c) 2017-2027 http://www.yn123.com All rights reserved.
// +----------------------------------------------------------------------
// | Notice: This code is not open source, it is strictly prohibited
// |         to distribute the copy, otherwise it will pursue its
// |         legal responsibility.
// | 注意：  这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用,
// |        不允许对程序代码以任何形式任何目的的再发布。
// +----------------------------------------------------------------------
// | Author: feraner <feraner@163.com> 
// | Date: 2019/11/6
// +----------------------------------------------------------------------

namespace app\index\controller;

use think\App;
use think\Db;

/**
 *
 * Class News
 * @package app\index\controller
 * @author feraner<feraner@163.com>
 * @date 2019/11/6
 */
class News extends UserBase
{

    public function __construct(App $app = null)
    {
        parent::__construct($app);
    }


    /**
     * 帮助中心
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function helpCenter()
    {
        $typeInfo = Db::name('web_news_type')
            ->where('flag', 'new_user')
            ->find() ?: [];

        $this->assign('typeInfo', $typeInfo);

        return $this->fetch();
    }


    /**
     * 资讯详情
     * @return mixed
     */
    public function newsDetail()
    {
        $newId = $this->request->param('id', 0);

        $this->assign('id', $newId);

        return $this->fetch();
    }


    /**
     * 某一类下资讯列表
     * @return mixed
     */
    public function newsList()
    {
        $newsTypeId = $this->request->param('typeId', 0);

        $this->assign('typeId', $newsTypeId);

        return $this->fetch();
    }

    /**
     * 单页资讯
     * @return mixed
     */
    public function singlePage()
    {
        $pageFlag = $this->request->param('pageFlag');

        $this->assign('pageFlag', $pageFlag);

        return $this->fetch();
    }


}
